<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2021/11/30
 * Time: 10:39
 */
namespace  animal;

class chicken extends bird
{
    function __construct($name,$type){
        $this->name=$name;
        $this->type=$type;
        echo '我是'.$name.'是一只'.$type;
        echo '<br/>';
    }
    static function eat(){
        echo '我会吃虫';
    }
    function fly()
    {
        self::$age=rand('1','12');
        parent::fly(); // TODO: Change the autogenerated stub
        echo '但我不会,我已经'.self::$age.'岁了';
        echo '<br/>';
        self::eat();
        echo '<br/>';
    }
    function __destruct()
    {
       echo $this->name.'在'.self::$age.'岁时';
        parent::__destruct(); // TODO: Change the autogenerated stub
    }
}